go
create PROCEDURE ConsultarMateriasReporte(@idProfesor INT)
AS
BEGIN
    SET NOCOUNT ON;
    
SELECT sec.id_seccion, sec.numeroSeccion, mat.nombreMateria
FROM SeccionMateria sec, Materia mat, periodoacademico per 
WHERE sec.fk_Profesor = @idProfesor and sec.fk_Materia = mat.id_materia and 
      sec.fk_PeriodoAcademico = per.id_periodoacademico and 
      sec.fk_PeriodoAcademico = (select ID_PERIODOACADEMICO 
								from PeriodoAcademico
								where (fechaInicio < GETDATE()) and (fechaFin >GETDATE()))
END;